﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CustomerTimeUp.ascx.cs" Inherits="webUserControl_CustomerTimeUp" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<div class="code">
    &nbsp;<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <cc1:CalendarExtender ID="CalendarExtender1" runat="server" 
        TargetControlID="tbOutDate">
    </cc1:CalendarExtender>
    客户名称：<asp:TextBox ID="tbCustomerName" runat="server"></asp:TextBox>
    地市：<asp:DropDownList ID="ddlCityID" runat="server" AutoPostBack="True" 
        onselectedindexchanged="ddlCityID_SelectedIndexChanged">
    </asp:DropDownList>
    <asp:DropDownList ID="ddlDistrictID" runat="server" Visible="False">
    </asp:DropDownList>

    &nbsp;时间点：<asp:TextBox ID="tbOutDate" runat="server"></asp:TextBox>
    <asp:Button ID="btnSearch" runat="server" Text="查找" onclick="btnSearch_Click" 
        ValidationGroup="A" />
    (如客户点位没有全部分配，则跳转至客户已分配点位详细列表进行逐个释放。)</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:LinFen %>" 
    
    SelectCommand="SELECT [ID], [CustomerName], [Addre], [TelPhone], [LinkMan], [YeWu], [isTotalPoint], [isOKPoint], [isTotalMoney], [isStatus], [outTime], [inTime] FROM [vw_CustomerInfo] WHERE (([outTime] &lt;= @outTime) AND ([CityID] = @CityID) AND ([DistrictID] = @DistrictID) AND ([CustomerName] LIKE '%' + @CustomerName + '%')) ORDER BY [outTime] DESC">
    <SelectParameters>
        <asp:ControlParameter ControlID="tbOutDate" Name="outTime" PropertyName="Text" 
            Type="DateTime" />
        <asp:ControlParameter ControlID="ddlCityID" Name="CityID" 
            PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="ddlDistrictID" Name="DistrictID" 
            PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="tbCustomerName" Name="CustomerName" 
            PropertyName="Text" Type="String" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:LinFen %>" 
    
    SelectCommand="SELECT [ID], [CustomerName], [Addre], [TelPhone], [LinkMan], [YeWu], [isTotalPoint], [isOKPoint], [isTotalMoney], [isStatus], [outTime], [inTime] FROM [vw_CustomerInfo] WHERE (([outTime] &lt;= @outTime) AND ([CityID] = @CityID) AND ([DistrictID] = @DistrictID) ) ORDER BY [outTime] DESC">
    <SelectParameters>
        <asp:ControlParameter ControlID="tbOutDate" Name="outTime" PropertyName="Text" 
            Type="DateTime" />
        <asp:ControlParameter ControlID="ddlCityID" Name="CityID" 
            PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="ddlDistrictID" Name="DistrictID" 
            PropertyName="SelectedValue" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
    ConnectionString="<%$ ConnectionStrings:LinFen %>" 
    SelectCommand="SELECT [ID], [CustomerName], [Addre], [TelPhone], [LinkMan], [YeWu], [isTotalPoint], [isOKPoint], [isTotalMoney], [isStatus], [outTime], [inTime] FROM [vw_CustomerInfo]  ORDER BY [outTime] DESC">
</asp:SqlDataSource>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataKeyNames="ID" Font-Size="12px" 
    ForeColor="#333333" GridLines="None" HorizontalAlign="Center" Width="100%" 
    onrowcommand="GridView1_RowCommand" 
    onpageindexchanging="GridView1_PageIndexChanging" onsorting="GridView1_Sorting" 
    PageSize="15" onrowdatabound="GridView1_RowDataBound">
    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <RowStyle BackColor="#E3EAEB" Font-Size="14px" HorizontalAlign="Center" />
    <Columns>
        <asp:BoundField DataField="ID" HeaderText="编号" InsertVisible="False" 
            ReadOnly="True" SortExpression="ID" />
        <asp:BoundField DataField="CustomerName" HeaderText="客户名称" 
            SortExpression="CustomerName" />
            <asp:BoundField DataField="CityName" HeaderText="城市" 
            SortExpression="CityName" />
            <asp:TemplateField HeaderText="地区" SortExpression="DistrictName">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("isType").ToString()=="省级"? "--":Eval("DistrictName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("DistrictName") %>'></asp:TextBox>
                </EditItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="Addre" HeaderText="地址" SortExpression="Addre" />
        <asp:BoundField DataField="TelPhone" HeaderText="电话" 
            SortExpression="TelPhone" />
        <asp:BoundField DataField="LinkMan" HeaderText="联络人" SortExpression="LinkMan" />
        <asp:BoundField DataField="YeWu" HeaderText="业务范围" SortExpression="YeWu" />
        <asp:BoundField DataField="isTotalPoint" HeaderText="总点位" 
            SortExpression="isTotalPoint" />
        <asp:BoundField DataField="isOKPoint" HeaderText="已分配" 
            SortExpression="isOKPoint" />
        <asp:BoundField DataField="isTotalMoney" DataFormatString="{0:f}" 
            HeaderText="金额" SortExpression="isTotalMoney" />
        <asp:TemplateField HeaderText="状态" SortExpression="isStatus">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("isStatus").ToString()=="0"?"已结束":"未结束" %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("isStatus") %>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="inTime" DataFormatString="{0:d}" HeaderText="开始时间" 
            SortExpression="inTime" />
        <asp:BoundField DataField="outTime" DataFormatString="{0:d}" HeaderText="截至时间" 
            SortExpression="outTime" />
        <asp:TemplateField HeaderText="释放点位">
            <ItemTemplate>
                <asp:Button ID="Button1" runat="server" CausesValidation="False" 
                    CommandArgument='<%# Eval("ID") %>'  CommandName="Del" Text="释放" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#7C6F57" />
    <AlternatingRowStyle BackColor="White" />
</asp:GridView>

